import cn.gudian.cms.Admin.AuthSession
import cn.gudian.cms.Admin.AdminU

class AdminFilters {

  def filters = {
    allFilter(controller: 'upload|adminRole|adminUser|place|arcType|article|page|sms|make|backGuest', action: '*') {
      before = {
        AdminU user = AuthSession.getUser(session)
        if (!user) {
          redirect(controller: 'adminAuth')
          return false
        }
      }
    }
    otherFilter(controller: 'stat|sysConfig|guestBook|comment', action: 'list|show|edit|update|delete|deleteAll|audit') {
      before = {
        AdminU user = AuthSession.getUser(session)
        if (!user) {
          redirect(controller: 'adminAuth')
          return false
        }
      }
    }

     uriFilter(uri:'/share/**') {
      before = {
        AdminU user = AuthSession.getUser(session)
        if (!user) {
          redirect(controller: 'adminAuth')
          return false
        }
      }
    }
  }
}
